package org.sgx.gwteditors.testgallery.gallery.model;

import java.util.List;

import org.sgx.gwteditors.client.impl1.basetypes.SelectionList;
import org.sgx.gwteditors.client.impl1.edbean.EditableBean;

import com.google.gwt.core.client.GWT;

public abstract class TableCreateCommand implements EditableBean {
	
	public static interface FTColumn {
		public static final String 
				TYPE_NUMBER = "NUMBER", 
				TYPE_STRING = "STRING", 
				TYPE_LOCATION = "LOCATION",
				TYPE_DATETIME = "DATETIME";
		
		public static final String[]TYPES = {
			TYPE_NUMBER, TYPE_STRING, TYPE_LOCATION, TYPE_DATETIME
		}; 
	}
	String name, description;
	Boolean isExportable;
	List<TableCreateCommandColumn> columns; 

//	public TableCreateCommand() {
//		name = UUID.uuid();
//		description="";
//		isExportable=false;
//		
//		//initialize the columns with a sample list of two 
//		columns = new LinkedList<TableCreateCommandColumn>(); 
//		TableCreateCommandColumn col1 = newSampleColumn();//new TableCreateCommandColumn();
//		col1.setName("name"); 
//		
//		TableCreateCommandColumn col2 = newSampleColumn();//new TableCreateCommandColumn();
//		col2.setName("age"); 
//		col2.getType().setSelection(FTColumn.TYPE_NUMBER); 
//	}

	private TableCreateCommandColumn newSampleColumn() {
		TableCreateCommandColumn c = GWT.create(TableCreateCommandColumn.class); 
		c.setName("unammedColumn"); 
		SelectionList<String> type = new SelectionList<String>(FTColumn.TYPES, new String[] { FTColumn.TYPE_STRING });
		type.setMultiple(false);
		c.setType(type); 
		return c;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Boolean getIsExportable() {
		return isExportable;
	}

	public void setIsExportable(Boolean isExportable) {
		this.isExportable = isExportable;
	}

	public List<TableCreateCommandColumn> getColumns() {
		return columns;
	}

	public void setColumns(List<TableCreateCommandColumn> columns) {
		this.columns = columns;
	}
	
	

}
